@page "/TicketForMe"
@attribute [UserNavigation("我的代办")]
@attribute [TabItemOption(Text = "我的代办", Icon = "fa-solid fas fa-bars")]

@rendermode InteractiveServer
<PageTitle>我的代办工单</PageTitle>

    <div class="d-flex justify-content-between align-items-center mb-4">
        <div>
            <h5>当前待完成</h5>
            <CountUp TValue="int" @bind-Value="@UnfinishedCount" class="fw-bold fs-2 text-danger"></CountUp>
        </div>
        <div>
            <h5>历史已完成</h5>
            <CountUp TValue="int" @bind-Value="@FinishedCount" class="fw-bold fs-2 text-success"></CountUp>
        </div>
    </div>

    <Tab  Placement="Placement.Auto"  >
    <TabItem Text="我的未处理工单" >
     
         <TicketTable FilterType="我的未处理工单" OnTotalCountChanged="HandleUnfinishedCountChanged"></TicketTable>
      
       
    </TabItem>
    <TabItem Text="我的历史完成工单"> 
    
        
         <TicketTable FilterType="我的历史完成工单" @ref="@TicketTableRef"  OnTotalCountChanged="HandleFinishedCountChanged"></TicketTable>
  
       
    </TabItem>
 
    </Tab>
@code
{
    private int UnfinishedCount { get; set; } // 未完成工单总数
    private int FinishedCount { get; set; }   // 已完成工单总数

    // 更新未完成工单总数
    private void HandleUnfinishedCountChanged(int totalCount)
    {
        UnfinishedCount = totalCount;
    }
    private TicketTable? TicketTableRef { get; set; } // 引用工单表格组件
    // 更新已完成工单总数
    private void HandleFinishedCountChanged(int totalCount)
    {
        FinishedCount = totalCount;
    }
 
}
 
 



